package agh.tk.markuptranslation;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import org.antlr.runtime.ANTLRInputStream;
import org.antlr.runtime.CommonTokenStream;


public class MainTxt2Tags
{
	public static Txt2tagsParser createTxt2tagsParser(InputStream input) throws IOException {
		ANTLRInputStream antlrInputStream = new ANTLRInputStream(input);
		Txt2tagsLexer lexer = new Txt2tagsLexer(antlrInputStream);
		CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
		Txt2tagsParser parser = new Txt2tagsParser(commonTokenStream);
		return parser;
	}

	
	public static void main(String args[])
	{
		try 
		{
			Txt2tagsParser parser = createTxt2tagsParser(new FileInputStream(new File("txt2tags.example")));
			Txt2tagsParser.txt2tagsFile_return result= parser.txt2tagsFile();
			IComponent component = result.value ;
			System.out.println("-------------------------TXT2TAGS --------------------------------------") ;
			System.out.println(component.toTxt2tags()) ;
			System.out.println("-------------------------DOKU WIKI--------------------------------------") ;
			System.out.println(component.toDokuWiki()) ;
			System.out.println("-------------------------MEDIA WIKI-------------------------------------") ;
			System.out.println(component.toMediaWiki()) ;
			System.out.println("---------------------------HTML-----------------------------------------") ;
			System.out.println(component.toHTML()) ;
		}
		catch (FileNotFoundException e) 
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (org.antlr.runtime.RecognitionException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}

/*
 * dodac window share
 * obraz jako link
 * sekcja text to html conversion
 * QUOTINGSYMBOL - powinien byc dodany pocz�tek nowej lini
 * tableRow - jesli '|' jest ostatnim symbolem w pliku - blad - token NULL
 * table do poprawy
 * czy potrzebny downloadable file
 * nie odczytuje pojedynczego znaku %
 * tak samo jak symbol html dodac symbol php
 * < nie pozwala na pojedyncze wyst�pienie....
 */

/* Zachowane
 
MAIL :
WORD "@" (WORD | '.')+ ;
*/
